package vip.liux.front.application.service.payment;

import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;
import vip.liux.contracts.infrastructure.automap.MapMapper;
import vip.liux.contracts.infrastructure.automap.MapStructConfig;
import vip.liux.front.domain.models.payment.PaymentRequest;
import vip.liux.front.domain.models.payment.PaymentRequestProduct;

@Mapper(config = MapStructConfig.class, uses = {MapMapper.class})
public interface AutoMapperProfile {

    AutoMapperProfile INSTANCE = Mappers.getMapper(AutoMapperProfile.class);

    @Mapping(target = "state", source = "state", qualifiedByName = "ordinal")
    PaymentRequestWithDetailsDto toDto(PaymentRequest paymentRequest);

    @Mapping(target = "paymentRequestId", source = "paymentRequest.id.paymentRequestId")
    @Mapping(target = "code", source = "paymentRequest.id.code")
    PaymentRequestProductDto toProductDto(PaymentRequestProduct paymentRequest);

}
